<template>
  <baseEchart :option="option"></baseEchart>
</template>

<script setup lang="ts">
import { computed, defineProps } from 'vue'

import baseEchart from './base-echart.vue'

import type { EChartsOption } from 'echarts'

interface DataType {
  name: string
  value: number
}

interface IProps {
  data: DataType[]
}

const props = defineProps<IProps>()

const option = computed<EChartsOption>(() => {
  return {
    tooltip: {
      trigger: 'item'
    },
    legend: {
      orient: 'horizontal',
      top: 'top'
    },
    series: [
      {
        name: 'Access From',
        type: 'pie',
        radius: '50%',
        data: props.data,
        emphasis: {
          itemStyle: {
            shadowBlur: 10,
            shadowOffsetX: 0,
            shadowColor: 'rgba(0, 0, 0, 0.5)'
          }
        }
      }
    ]
  }
})
</script>

<style lang="scss" scoped></style>
